package com.yuexun.dhdoctor.module.personalPlan.ui;

import android.content.Intent;
import android.view.View;
import android.widget.RadioButton;
import android.widget.TextView;

import com.yuexun.dhdoctor.R;
import com.yuexun.dhdoctor.base.BaseKJActivity;
import com.yuexun.dhdoctor.module.personalPlan.ui.fragment.Frag_MyPlan;
import com.yuexun.dhdoctor.module.personalPlan.ui.fragment.Frag_MySchedule;
import com.yuexun.dhdoctor.module.personalPlan.ui.fragment.Frag_OtherPlan;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by work-jx on 2016/9/5.
 */
public class Act_PlanMain extends BaseKJActivity {

    @Bind(R.id.ib_right)
    TextView ibRight;
    @Bind(R.id.rb_schedule)
    RadioButton rbSchedule;
    private String type;

    private String show;

    @Override
    public void setRootView() {
        setContentView(R.layout.act_task);
        ButterKnife.bind(this);
    }

    @Override
    public void initData() {
        super.initData();
        show = getIntent().getExtras().getString("show");
        if (show.equals("1")) {
            changeFragment(R.id.plan_content, new Frag_MyPlan());
            type = "我的计划";
        } else {
            rbSchedule.setChecked(true);
            changeFragment(R.id.plan_content, new Frag_MySchedule());
            type = "我的日程";
            ibRight.setVisibility(View.GONE);
        }
    }


    @OnClick({R.id.back, R.id.rb_my_plan, R.id.rb_share_plan, R.id.rb_schedule, R.id.ib_right})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.back:
                finish();
                break;
            case R.id.rb_my_plan:
                changeFragment(R.id.plan_content, new Frag_MyPlan());
                type = "我的计划";
                ibRight.setVisibility(View.VISIBLE);
                break;
            case R.id.rb_share_plan:
                changeFragment(R.id.plan_content, new Frag_OtherPlan());
                type = "我的计划";
                ibRight.setVisibility(View.GONE);
                break;
            case R.id.rb_schedule:
                changeFragment(R.id.plan_content, new Frag_MySchedule());
                type = "我的日程";
                ibRight.setVisibility(View.GONE);
                break;
            case R.id.ib_right:
                Intent intent = new Intent(aty, Act_MyShare.class);
                intent.putExtra("type", type);
                startActivity(intent);
                break;
        }
    }
}
